﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class RegisterForm : Form
    {
        public RegisterForm()
        {
            InitializeComponent();
        }

        //取消
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //注册账号
        private void button1_Click(object sender, EventArgs e)
        {
            var uid = textBox1.Text;
            var pwd = textBox2.Text;
            var rePwd = textBox3.Text;

            var hsaUid = !string.IsNullOrEmpty(uid);
            var hsaPwd = !string.IsNullOrEmpty(pwd);
            var eqPwd = pwd == rePwd;

            if (hsaUid && hsaPwd && eqPwd)
            {
                MessageBox.Show("注册成功","提示");
                Form1.user.Add(uid,pwd);
                this.Hide();
            }
            else
            {
                MessageBox.Show("注册失败", "提示");
            }
        }
    }
}
